# for i in range(3,7):
#     s=i
#     for j in range(1,i):
#         if i%j==0:
#             s-=j
#     if s==0:
#         print(i)

# def fun(lst):
#     t=lst[0]
#     for i in range(1,len(lst)):
#         lst[i-1]=lst[i]
#     lst[len(lst)-1]=t
# l=[1,2,3,4,5]
# fun(l)
# print(l)

# n="345"
# n=int(n)
# a=(n//100)**2
# b=n%10
# c=(n//10)%10
# d=a+c+b
# print(a,b,c,"%.2f"%(d),sep=",")

# def fun(l):
#     l.extend([4,5])
#     return l
# l=[3,2,1]
# l=fun(l)
# n=sum(l)
# print(l,n)

# def fun(a,*b):
#     global n
#     s=sum(b)
#     print(s)
#     c=a*(n//10)
#     n=c[::-1]
#     return c
# l=[3,2,1]
# n=20
# s=fun(l,6,7,8)
# print(s,n)

# l=[2,5,16,24,37]
# flag=0
# a=int(input())
# for i in range(len(l)):
#     if a<l[i]:
#         l.insert(i,a)
#         flag=1
#         break
# if flag==0:
#     l.append(a)
# print(l)

def func(n):
    sum=0
    for i in range(1,n):
        if n%i==0:
            sum+=i
    if sum==n:
        return True
    else:
        return False
for i in range(1000):
    if func(i):
        print(i)
